﻿using Cxuu.Models;
using Cxuu.Service;
using Microsoft.AspNetCore.Mvc;
using PetaPoco;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Cxuu.Web.Home
{
    [Area("Home")]
    public class ContentController : Base
    {
        private readonly ArticleService _articleService;
        private readonly ArticleCateService _articleCateService;

        public ContentController(ArticleService articleService, ArticleCateService articleCateService)
        {
            _articleService = articleService;
            _articleCateService = articleCateService;
        }

        /// <summary>
        /// 全部内容页列表 分页
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> IndexAsync(int page = 1, int limit = 15)
        {
            Page<ViewArticleAndCate> viewArticleAndCates = await _articleService.GetListAsync(page, limit);
            return View(viewArticleAndCates);
        }
       
    }
}
